﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace P8_Method
{
    public class Program
    {
        static void Main(string[] args)
        {
            // int 类型的b直接调用Add方法，相当于内置，不需要用类名调用
            int b = 10;
            b.Add();
            double Area;
            Calculator c = new Calculator();
            Area = c.GetCircleArea(10);
            Console.WriteLine($"圆的面积为：{Area}");
            Console.WriteLine("===============================================");
            Student s = new Student();
            Console.WriteLine($"Student_ID:{s.ID},Student_Name:{s.Name}");
            Student s1 = new Student(15, "Make");
            Console.WriteLine($"Student_ID:{s1.ID},Student_Name:{s1.Name}");
            Console.WriteLine($"新的人生开始2024/09/08");
        }
    }

    /// <summary>
    /// 学生类-构造函数
    /// </summary>
    public class Student
    {
        public int ID;
        public string Name;

        /// <summary>
        /// 方法重载
        /// </summary>
        public int Add(int a, int b)
        {
            return a + b;
        }

        /// <summary>
        /// 方法重载,多一个参数
        /// </summary>
        public int Add(int a, int b, int c)
        {
            return a + b + c;
        }

        /// <summary>
        /// 方法重载，参数类型不一样
        /// </summary>
        public double Add(double a, double b)
        {
            return a + b;
        }

        public Student(int initid, string initname)
        {
            this.ID = initid;
            Name = initname;
        }

        public Student()
        {
            this.ID = 0;
            this.Name = "No Name";
        }
    }

    /// <summary>
    /// 计算图形面积方法
    /// </summary>
    public class Calculator
    {
        /// <summary>
        /// 圆的面积
        /// </summary>
        public double GetCircleArea(double r)
        {
            double Area = Math.PI * r * r;
            return Area;
        }

        /// <summary>
        /// 圆柱的面积
        /// </summary>
        public double GetCylinderVolume(double r, double h)
        {
            double Area = GetCircleArea(r) * h;
            return Area;
        }

        /// <summary>
        /// 圆锥的面积
        /// </summary>
        public double GetConeVolume(double r, double h)
        {
            double Area = GetCylinderVolume(r, h) / 3;
            return Area;
        }
    }
}
